package org.baicaix.game.warworms.battle {
	import org.baicaix.game.worms.worm.Worm;
	import org.baicaix.game.worms.battle.SceneCamera;

	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.MouseEvent;

	/**
	 * @author dengyang
	 * @date 2010-4-28
	 */
	public class CameraTest extends Sprite {
		
		[Embed(source="5.png")]
		private var BackImg : Class;

		public function CameraTest() {
			
			initStage();
			
			var scene : Sprite = addChild(new Sprite()) as Sprite;
			scene.addChild(new BackImg());
			
			scene.addChild(new Worm("aaaa"));
			
			SceneCamera.getInstance().init(550, 400, scene.width, scene.height);
			SceneCamera.getInstance().setScene(scene);
			
			this.addEventListener(MouseEvent.CLICK, clickHandler);
		}

		private function initStage() : void {
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
		}

		private function clickHandler(event : MouseEvent) : void {
			//localX才不至於根據舞臺變化
			SceneCamera.getInstance().moveTo(event.localX, event.localY);
		}
	}
}
